﻿using System;
using System.Diagnostics;
using System.Windows.Forms;

using AmazonBookLinker.Diagnostics;

namespace AmazonBookLinker
{
  internal partial class AboutBoxForm : Form
  {
    internal AboutBoxForm()
    {
      InitializeComponent();

      // Set the form's title
      Text = "About " + AssemblyInfo.Title;

      // Set the product title
      lblProductTitle.Text = string.Format( "{0} v{1}.{2}", AssemblyInfo.ProductName, AssemblyInfo.Version.Major, AssemblyInfo.Version.Minor );

      // Set the copyright information
      lblCopyrightInfo.Text = AssemblyInfo.Copyright;

      // Set the product description
      txtProductDescription.Text = AssemblyInfo.Description;

      // Set the company name
      lnkCompanyName.Text = AssemblyInfo.Company;
      lnkCompanyName.LinkBehavior = LinkBehavior.AlwaysUnderline;
      lnkCompanyName.Links.Add( 0, AssemblyInfo.Company.Length, @"http://www.briandicroce.com" );
      lnkCompanyName.LinkClicked += delegate( object sender, LinkLabelLinkClickedEventArgs e ) { Process.Start( e.Link.LinkData.ToString() ); };
    }


    private void btnDonate_Click( object sender, EventArgs e )
    {
        Process.Start(@"http://www.amazon.ca/gp/registry/wishlist/3CN1GCOZI74JX/ref=cm_wl_rlist_go_v?");
    }


    private void btnOK_Click( object sender, EventArgs e )
    {
      DialogResult = DialogResult.OK;
      Close();
    }


    private void checkForUpdatesButton_Click( object sender, EventArgs e )
    {
      Context.CheckForNewVersion(false);
    }
  }
}